﻿using System;

namespace Adaptive.Foundation.Tokenizers
{
    /// <summary>
    /// Represents an assignment of type, and operation values to a character value.
    /// </summary>
    /// <remarks>
    /// 
    /// </remarks>
    public class CharacterTypeEntry : AiObjectBase 
    {
        /*--------------------------------------------------------------------------------
         * Private Member Declarations
         *------------------------------------------------------------------------------*/
        #region Private Member Declarations
        /// <summary>
        /// Specific character assignment.
        /// </summary>
        private char _specificChar = (char)0;
        /// <summary>
        /// The character value being represented.
        /// </summary>
        private CharacterTokenValues _value = CharacterTokenValues.None;
        /// <summary>
        /// The character operation assigned to the character value.
        /// </summary>
        private CharacterTokenOperations _assignedOperation = CharacterTokenOperations.None;
        /// <summary>
        /// The character type assigned to the character value.
        /// </summary>
        private CharacterTokenTypes _assignedType = CharacterTokenTypes.None;
        #endregion

        /*--------------------------------------------------------------------------------
         * Constructor / Dispose Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose Methods
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <remarks>
        /// This is the default constructor.
        /// </remarks>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        public CharacterTypeEntry(CharacterTokenValues characterToken)
            : base()
        {
            _value = characterToken;
            Name = _value.ToString();
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="type">
        /// A <see cref="CharacterTokenTypes"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(CharacterTokenValues characterToken, CharacterTokenTypes type)
            : this(characterToken)
        {
            _assignedType = type;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="operation">
        /// A <see cref="CharacterTokenOperations"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(CharacterTokenValues characterToken, CharacterTokenOperations operation)
            : this(characterToken)
        {
            _assignedOperation = operation;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="type">
        /// A <see cref="CharacterTokenTypes"/> assigned to the character value.
        /// </param>
        /// <param name="operation">
        /// A <see cref="CharacterTokenOperations"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(CharacterTokenValues characterToken, CharacterTokenTypes type, CharacterTokenOperations operation)
            : this(characterToken)
        {
            _assignedType = type;
            _assignedOperation = operation;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <remarks>
        /// This is the default constructor.
        /// </remarks>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        public CharacterTypeEntry(char characterToken)
            : base()
        {
            _specificChar = characterToken;
            _value = CharacterTokenFactory.GetTokenValue(_specificChar);
            Name = _value.ToString();
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="type">
        /// A <see cref="CharacterTokenTypes"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(char characterToken, CharacterTokenTypes type)
            : this(characterToken)
        {
            _assignedType = type;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="operation">
        /// A <see cref="CharacterTokenOperations"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(char characterToken, CharacterTokenOperations operation)
            : this(characterToken)
        {
            _assignedOperation = operation;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="characterToken">
        /// A <see cref="CharacterTokenValues"/> enumerated value.
        /// </param>
        /// <param name="type">
        /// A <see cref="CharacterTokenTypes"/> assigned to the character value.
        /// </param>
        /// <param name="operation">
        /// A <see cref="CharacterTokenOperations"/> assigned to the character value.
        /// </param>
        public CharacterTypeEntry(char characterToken, CharacterTokenTypes type, CharacterTokenOperations operation)
            : this(characterToken)
        {
            _assignedType = type;
            _assignedOperation = operation;
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets or sets the specific character for the entry.
        /// </summary>
        /// <value>The specific character value.</value>
        public char SpecificCharacter
        {
            get
            {
                return _specificChar;
            }
            set
            {
                _specificChar = value;
                _value = CharacterTokenFactory.GetTokenValue(_specificChar);
                Name = _value.ToString();
            }
        }
        /// <summary>
        /// Gets the character token value.
        /// </summary>
        /// <value>
        /// A <see cref="CharacterTokenValues"/> enumerated value indicating
        /// the character being represented.
        /// </value>
        public CharacterTokenValues Value
        {
            get
            {
                return _value;
            }
        }
        /// <summary>
        /// Gets or sets the operation assigned to the character token value.
        /// </summary>
        /// <value>
        /// A <see cref="CharacterTokenOperations"/> enumerated value indicating
        /// the assigned operation.
        /// </value>
        public CharacterTokenOperations AssignedOperation
        {
            get
            {
                return _assignedOperation;
            }
            set
            {
                _assignedOperation = value;
            }
        }
        /// <summary>
        /// Gets or sets the toke ntype assigned to the character token value.
        /// </summary>
        /// <value>
        /// A <see cref="CharacterTokenTypes"/> enumerated value indicating
        /// the assigned token type.
        /// </value>
        public CharacterTokenTypes AssignedType
        {
            get
            {
                return _assignedType;
            }
            set
            {
                _assignedType = value;
            }
        }
        #endregion
    }
}